<!doctype html>
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<html>
<head>
<meta charset="utf-8">

<jsp:include page="/common/commonCss.jsp"/>
<jsp:include page="/common/commonJs.jsp"/>
<link rel="stylesheet" type="text/css" href="${basePath }commonCss/css/global.css">
<link rel="stylesheet" type="text/css" href="${basePath }commonCss/css/layout.css">
<link rel="stylesheet" type="text/css" href="${basePath }commonCss/css/easyui.css">
<script src="${basePath }commonJs/jquery.min.js"></script>
<script src="${basePath }commonJs/jquery.easyui.min.js"></script>
<script src="${basePath }commonJs/jt_normal.js"></script>
<script src="${basePath }commonJs/jt_select.js"></script>
<script language="javascript" src="${basePath }commonJs/tags/My97DatePicker/WdatePicker.js"></script>

<script src="${basePath }commonJs/promotion/wolf_common.js"></script>
<script src="${basePath }commonJs/promotion/wolf_validation.js"></script>
<title>嘉童游乐中心-库存调整</title>
</head>
<script type="text/javascript">
var au_brank = '${branId}';
jQuery(document).ready(function () {
	defultLoad();
});
/**
 * 首页数据加载
 */
function defultLoad(){
	var form = $("#role_home_form"); 
    var pagebean = new PageBean(form);
    pagebean.setTableId("role_home_table");
    pagebean.setCallback(defultLoadCall);
    pagebean.setFootId("role_home_page");
    setPagebeanObj(pagebean); 
    pagebean.doPage();
}
function defultLoadCall(data){
	if(wolf.isNotNull(data)){
		var flag = (au_brank == 'ZB');
		wolf.data_foreach(data, function(i,obj){
			var roleId = obj.pkRoleId;
			var roleEdit = "<a href=\"${basePath }authority/role/editRolePage.shtml?pkRoleId="+roleId+"\">"+obj.roleName+"</a>";
			var roleShow = (flag?roleEdit:obj.roleName);
			var tr = "<tr>"+
						" <td>"+(i+1)+"</td>"+
		            	" <td class=\"lv\">"+roleShow+"</td>"+
		            	" <td>"+obj.roleDesc+"</td>"+
		                " <td>"+(obj.userName==null?"":obj.userName)+"</td>"+
		                " <td>"+(obj.modiTimeStr==null?"":obj.modiTimeStr)+"</td>"+
		            	" <td>_option_</td>"+
		             "</tr>";
		      if(wolf.isNotNull(obj.reserveFlag) && obj.reserveFlag == 1){
		    	 tr =  tr.replace("_option_", "");
		      }else if(flag){
		    	  tr =  tr.replace("_option_", "<input type=\"button\" value=\"删除\" class=\"btn_l \"  onclick=\"delRole('"+roleId+"')\">");
		      }else{
		    	  tr =  tr.replace("_option_", "");
		      }
		    $("#role_home_table").append(tr);
		});
	}
}
function delRole(roleId){
	if(isVery()){
		$.messager.confirm('提示', '你确定要删除吗?', function(r) {
			if (r) {
				$.ajax({ 
					url: "${basePath }authority/role/deleteByRoleId.shtml",
					data:"pkRoleId="+roleId,
					dataType: 'json',
					type:'POST',
					success: function(data){
						defultLoad();
			      	}
				});
			}
		});
	}
}
function isVery(){
	if(au_brank == 'ZB'){
		return true;
	}else{
		alertInfo("对不起！无此操作权限！");
		return false;
	}
}
</script>
<body class="bg">
<div class="content m_auto">
	<div class="content_l mt10">
    	<ul>
    	<shiro:hasPermission name="authority/role/home.shtml">
         <li class="content_hover"><a href="${basePath}authority/role/home.shtml"><i class="nav_icon_u"></i><br>角色管理</a></li>
           </shiro:hasPermission>
           <shiro:hasPermission name="authority/user/home.shtml">
            <li><a href="${basePath}authority/user/home.shtml"><i class="nav_icon_t"></i><br>用户管理</a></li>
           </shiro:hasPermission>
           <shiro:hasPermission name="SalesRelation/mem.shtml">
            <li><a href="${basePath}SalesRelation/mem.shtml"><i class="nav_icon_s"></i><br>销售关联会员</a></li>
            </shiro:hasPermission>
            <shiro:hasPermission name="ParRoomDetail/ParRoom.shtml">
            <li ><a href="${basePath}ParRoomDetail/ParRoom.shtml"><i class="nav_icon_r"></i><br>房间管理</a></li>
           </shiro:hasPermission>
           <shiro:hasPermission name="SysBarCode/system.shtml">
            <li><a href="${basePath }SysBarCode/system.shtml"><i class="nav_icon_q"></i><br>条码维护</a></li>
            </shiro:hasPermission>
            <shiro:hasPermission name="WfmAuthorize/toShenP.shtml">
            <li><a href="${basePath}WfmAuthorize/toShenP.shtml"><i class="nav_icon_s"></i><br>审批转授权</a></li>
            </shiro:hasPermission>
            <shiro:hasPermission name="holiday/sysHoliday.shtml">
            <li><a href="${basePath}holiday/sysHoliday.shtml"><i class="nav_icon_q"></i><br>节假日管理</a></li>
            </shiro:hasPermission>
        </ul>
    </div>
    <div class="content_r mt10">
    	<!---- 内容 --->
        <div class="file_single_dl fixed mt20">
        	<form action="${basePath }authority/role/seacheRoleWhere.shtml" id="role_home_form">
	        	<dl>
	            	<dd><label>角色名称：</label><input type="text" class="iput_t w200" name="roleName"></dd>
	                <dd>
		                <input type="button" class="btn ml10" value="查询" onclick="defultLoad();">
		                <input type="button" class="btn ml10" value="新增" 
		                onClick="javascript:if(isVery()){window.location.href='${basePath }authority/role/addRolePage.shtml'}">
		            </dd>
	            </dl>
	        <input type="hidden" name="pageNo" value="1">
	        <input type="hidden" name="pageSize" value="7">
            </form>
        </div>
        <div class="m10">
        <table class="table" id="role_home_table">
        	<tr>
            	<th>序号</th>
                <th>角色名称</th>
                <th>角色描述</th>
                <th>修改人</th>
                <th>修改时间</th>
                <th>操作</th>
            </tr>
            <!-- <tr>
            	<td>1</td>
            	<td class="lv"><a href="system_jues_x.html">操作员</a></td>
                <td>系统管理员角色，拥有所有权限</td>
                <td>张三丰</td>
                <td>2014-09-06 15:22:33</td>
                <td><input type="button" value="删除" class="btn_l "></td>
            </tr>
            <tr>
            	<td>2</td>
            	<td class="lv"><a href="system_jues_x.html">操作员</a></td>
                <td>系统管理员角色，拥有所有权限</td>
                <td>张三丰</td>
                <td>2014-09-06 15:22:33</td>
                <td><input type="button" value="删除" class="btn_l "></td>
            </tr>
            <tr>
            	<td>3</td>
            	<td class="lv"><a href="system_jues_x.html">操作员</a></td>
                <td>系统管理员角色，拥有所有权限</td>
                <td>张三丰</td>
                <td>2014-09-06 15:22:33</td>
                <td><input type="button" value="删除" class="btn_l "></td>
            </tr> -->
        </table>
        <!----翻页----->
        
        <div class="page fr m10" id="role_home_page">
            <span>第3/2000页</span>
            <span>首页</span>
            <span>上一页</span>
            <span><a href="#">下一页</a></span>
            <span><a href="#">末页</a></span>
            <span>跳转到<input type="text" class="black_text mlr5">页</span>
        </div>
        <!----翻页----->
        </div>
        <!---- 内容 --->
    </div>
</div>


</body>
</html>